<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>温度转换界面</title>
</head>
<body>
<form name="form1">
    <p>
        <label for="degree-fahrenheit">
            Degree Fahrenheit:
            <input id="degree-fahrenheit" type="number" name="degreeFahrenheit">
        </label>
    </p>
    <p>
        <label for="degrees-centigrade">
            Degrees Centigrade:
            <input id="degrees-centigrade" type="text" name="degreesCentigrade" readonly="readonly">
        </label>
    </p>
</form>
<script>
    var form1 = document.form1;
    form1.addEventListener('input', convert);

    function convert() {
        //    Equation is °C = 5/9 (°F - 32).
        var degreesFahrenheit = parseFloat(form1.degreeFahrenheit.value);
        form1.degreesCentigrade.value = Math.round(5 / 9 * (degreesFahrenheit - 32));
    }
</script>
</body>
</html>